package com.cxyzy.demo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        toolbar.inflateMenu(R.menu.edit_menu)
        toolbar.setNavigationOnClickListener {
            toast("Back")
        }
        toolbar.setOnMenuItemClickListener { item ->
            when (item.itemId) {
                R.id.action_search -> toast("Search")
                R.id.action_del -> toast("Delete")
                R.id.action_warn -> toast("Warn")
                R.id.action_settings -> toast("Settings")
            }
            false
        }

    }
}
